using System;
using QiAdmin.Core;
using QiAdmin.Core.Services.Cache;

namespace QiAdmin.Model.Dtos.Output
{
    /// <summary>
    /// t_sys_user:数据传输Output类
    /// 
    /// </summary>
    [Serializable]

    public class TSysUser_OUT
    {

        /// <summary>
        ///主键
        /// </summary>
        public Int32 Id { get; set; }

        /// <summary>
        ///系统字段-创建人
        /// </summary>
        public Int32 SysCreateUser { get; set; }

        /// <summary>
        ///系统字段-创建时间
        ///默认值:CURRENT_TIMESTAMP
        /// </summary>
        public DateTime SysCreateTime { get; set; }

        /// <summary>
        ///系统字段-修改人
        /// </summary>
        public Int32 SysUpdateUser { get; set; }

        /// <summary>
        ///系统字段-修改时间
        ///默认值:CURRENT_TIMESTAMP
        /// </summary>
        public DateTime SysUpdateTime { get; set; }

        /// <summary>
        ///系统字段-删除人
        /// </summary>
        public Int32 SysDeleteUser { get; set; }

        /// <summary>
        ///系统字段-删除时间
        /// </summary>
        public DateTime SysDeleteTime { get; set; }

        /// <summary>
        ///系统字段-删除标记
        ///默认值:0
        /// </summary>
        public Boolean SysIsDelete { get; set; }

        /// <summary>
        ///部门ID
        /// </summary>
        public Int32 DeptId { get; set; }

        /// <summary>
        ///登录账号
        /// </summary>
        public String? Account { get; set; }

        /// <summary>
        ///用户名
        /// </summary>
        public String? Name { get; set; }

        /// <summary>
        ///密码
        /// </summary>
        public String? PassWord { get; set; }

        /// <summary>
        ///角色ID
        /// </summary>
        public Int32 RoleId { get; set; }

        /// <summary>
        ///状态(10正常，00冻结)
        ///默认值:10
        /// </summary>
        public String? Status { get; set; }

        /// <summary>
        ///头像
        /// </summary>
        public String? Avatar { get; set; }

        /// <summary>
        ///电话
        /// </summary>
        public String? Tel { get; set; }

        /// <summary>
        ///邮箱
        /// </summary>
        public String? Email { get; set; }

        /// <summary>
        ///备注
        /// </summary>
        public String? Remark { get; set; }

        public String? DeptName
        {
            get
            {
                var cache = App.GetService<ICacheService>().Get<List<TSysDept_OUT>>(App.StaticData.CacheKey_Dept);
                return cache?.Find(x => x.Id == DeptId)?.Name;

            }
        }
        public String? RoleName
        {
            get
            {
                var cache = App.GetService<ICacheService>().Get<List<TSysRole_OUT>>(App.StaticData.CacheKey_Role);
                return cache?.Find(x => x.Id == RoleId)?.Name;

            }
        }

    }
}